class Node {
   constructor(element) {
    this.element = element
    this.next = null
   }
}
class LinedList {
  constructor() {
  this.size = 0
  this.head = null
  }

 append(element) {
 let node = new Node(element)
   if(this.head==null) {
       this.head = node
   }else {
    let current = this.getNode(this.size -1)
    current.next =node
   }
    this.size++
 }
  appendAt(position,element) {
    let node =new Node(element)
    if(position===0) {
      node.next = this.head
      this.head = node
    }else {
      let pre = this.getNode(position-1)
      node.next =pre.next
      pre.next = node
    }
  }

  remove(element) {
  }

  getNode(index) {
     let current = this.head
      for(let i=0;i<index;i++) {
         current = current.next
      }
    return current
  }
}

let ll = new LinedList()
ll.append(1)
ll.append(2)
ll.append(3)
// ll.remove(0)
//ll.append(1)
console.dir(ll,{
  depth: 100
})
